module.exports = Route = require('koa-router')

{isPlainObject} = require 'lodash'

require('methods').forEach (method)->
    _method = Route.prototype[method]
    Route.prototype[method] = (map) ->
        if isPlainObject(map)
            for path, middleware of map
                _method.call @, path, middleware
            return @
        else
            return _method.apply(@, arguments)
